<div class="row animate fadeIn">
    <div class="ibox-title" style="border:none;"><h5 style="color: #00afef"><i>Add</i></h5>
        <div class="ibox-tools">    
             <button class="btn btn-primary btn-sm save-btn-tab" id="submit-uom">Save</button>
             <a id="cancel_add" class="btn btn-sm btn-outline btn-info cancel-btn-tab">Cancel</a>
        </div>
     </div>
     <div class="ibox-content">
      <form class="form-horizontal" id="im_request_form">
        <div class="form-group">
          <label class="col-lg-4 control-label">Case No.</label>
            <div class="col-lg-4">
              <input type="text" name="case_no" class="form-control">
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Case Date</label>
            <div class="col-lg-4">
              <input type="date" name="case_date" class="form-control">
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Case Type</label>
            <div class="col-lg-4">
              <select name="case_type" class="form-control chosen">
                <option value="">--</option>
                <?php foreach($case_type as $ct): ?>
                <option value="<?php echo $ct->lookup_code; ?>"><?php echo $ct->meaning; ?></option>
                <?php endforeach; ?>
              </select>
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Caller Account ID</label>
            <div class="col-lg-5">
              <input type="text" name="caller_acct_id" class="form-control">
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Caller Name</label>
            <div class="col-lg-5">
              <input type="text" name="caller_name" class="form-control">
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Caller Address</label>
            <div class="col-lg-5">
              <textarea rows="3" name="caller_address" class="form-control">
              </textarea>
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Caller Contact</label>
            <div class="col-lg-5">
              <input type="text" name="caller_contact" class="form-control">
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Category</label>
            <div class="col-lg-4">
              <select name="category" class="form-control chosen">
                <option value="">--</option>
                <?php foreach($category as $c): ?>
                <option value="<?php echo $c->lookup_code; ?>"><?php echo $c->meaning; ?></option>
                <?php endforeach; ?>
              </select>
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Sub Category</label>
            <div class="col-lg-4">
              <select name="sub_category" class="form-control chosen">
                <option value="">--</option>
                <?php foreach($sub_category as $sc): ?>
                <option value="<?php echo $sc->lookup_code; ?>"><?php echo $sc->meaning; ?></option>
                <?php endforeach; ?>
              </select>
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Impact</label>
            <div class="col-lg-4">
              <select name="impacy" class="form-control chosen">
                <option value="">--</option>
                <?php foreach($impact as $imp): ?>
                <option value="<?php echo $imp->lookup_code; ?>"><?php echo $imp->meaning; ?></option>
                <?php endforeach; ?>
              </select>
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Urgency</label>
            <div class="col-lg-4">
              <select name="urgency" class="form-control chosen">
                <option value="">--</option>
                <?php foreach($urgency as $ur): ?>
                <option value="<?php echo $ur->lookup_code; ?>"><?php echo $ur->meaning; ?></option>
                <?php endforeach; ?>
              </select>
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Case Title</label>
            <div class="col-lg-5">
              <input type="text" name="case_title" class="form-control">
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Case Details</label>
            <div class="col-lg-5">
              <textarea rows="3" name="case_details" class="form-control">
              </textarea>
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Desired Date</label>
            <div class="col-lg-5">
              <input type="date" name="desired_date" class="form-control">
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Department</label>
            <div class="col-lg-5">
              <select name="department" class="form-control chosen">
                <option value="">--</option>
                <?php foreach($department as $dep): ?>
                <option value="<?php echo $dep->lookup_code; ?>"><?php echo $dep->meaning; ?></option>
                <?php endforeach; ?>
              </select>
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Activity Status</label>
            <div class="col-lg-5">
              <select name="activity_status" class="form-control chosen">
                <option value="">--</option>
                <?php foreach($activity_status as $as): ?>
                <option value="<?php echo $as->lookup_code; ?>"><?php echo $as->meaning; ?></option>
                <?php endforeach; ?>
              </select>
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Case Status</label>
            <div class="col-lg-5">
              <select name="case_status" class="form-control chosen">
                <option value="">--</option>
                <?php foreach($case_status as $cst): ?>
                <option value="<?php echo $cst->lookup_code; ?>"><?php echo $cst->meaning; ?></option>
                <?php endforeach; ?>
              </select>
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Root Cause</label>
            <div class="col-lg-5">
              <textarea rows="3" name="root_cause" class="form-control">
              </textarea>
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Date Resolved</label>
            <div class="col-lg-5">
              <input type="date" name="date_resolved" class="form-control">
            </div>
        </div>
        <div class="form-group">
          <label class="col-lg-4 control-label">Releated Doc. No.</label>
            <div class="col-lg-5">
              <input type="text" name="related_doc_no" class="form-control">
            </div>
        </div>
      </form>
    </div>
 </div>
 <script>
    $(document).ready(function(){
            $('.i-checks').iCheck({
                    checkboxClass: 'icheckbox_square-green',
                    radioClass: 'iradio_square-green',
              });
            $('select').chosen({width : "100%"});
            $("#uom-form").validate({
                 rules: {
                     company_name: {
                         required: true,
                         lettersonly: true
                     },
                     uom_code: {
                         required: true,
                         capitalonly: true
                     },
                     uom_name: {
                         required: true,
                         lettersonly: true
                     }
                 },
                 submitHandler: function(form){
                    $.ajax({
                        type: "POST",
                        url: "<?php echo base_url($this->session->userdata('forajax').'/insert_uom'); ?>",
                        data: $('#uom-form').serialize(),
                        dataType: 'json',
                        success: function(data){
                           if(data[0].error != 1){
                                notifymsg("success",". . .Units of Measure Added Successfully");
                                close_add(); active_search();
                           }else{
                            notifymsg("danger",data[0].msg);
                           }
                        },
                        complete: function() {

                        },
                        beforeSend: function(){
                           
                        }
                    });
                 }
             });

            function alert_cancel(){
              if($('#uom_cn').val() != "" || $('#uom_c').val() != "" || $('#uom_n').val() != "" || $('#uom_cb').is(':checked') == false){
                                                swal({
                                                      title: "Are you sure?",
                                                      text: "Your work will not be save",
                                                      type: "warning",
                                                      showCancelButton: true,
                                                      confirmButtonColor: "#DD6B55",
                                                      confirmButtonText: "Leave",
                                                      cancelButtonText: "Stay",
                                                      closeOnConfirm: true,
                                                      closeOnCancel: true },
                                                  function (isConfirm) {
                                                      if (isConfirm) {
                                                        swal("success");
                                                          close_add(); active_search();
                                                          notifymsg("hide","hide");
                                                      } else {
                                                          swal("Cancelled");
                                                      }
                                                  });
                            }else{
                                close_add(); active_search();
                                notifymsg("hide","hide");
                            }
            }
            $('#cancel_add').click(function(){
                alert_cancel();
            });




    $('#addX').click(function(){
            alert_cancel();      
       });
    });
 </script>  